package cn.tedu.spring.eg3;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ShopController {

    private String name;


    public ShopController() {
        System.out.println("1:调用无参构造实例化;");
    }

    @Value("国庆节")
    public void setName(String name) {
        this.name = name;
        System.out.println("2:调用set()方法进行属性赋值;");
    }

    @PostConstruct
    public void init() {
        System.out.println("3:执行生命周期初始化方法;");
    }
    @PreDestroy
    public void destroy() {
        System.out.println("5:执行生命周期销毁方法;");
    }
}
